home *** CD-ROM | disk | FTP | other *** search
- /* disktest.c - test raw disk i/O */
- #include "stdio.h"
- #include "ctype.h"
-
- #define ASIZE 25000 /* size of area for a buffer */
-
- long seqio() , randio() ;
- char *align() ;
-
- main(argc,argv)
- int argc ;
- char *argv[] ;
- {
- int dno , nstart , nseg , i , nit ;
- int offset ;
- char area[ ASIZE ] ;
- float t ;
- char *pbuf ;
-
- /* ensure that the buffer does not cross a 64K address boundary */
- pbuf = align(area,ASIZE/2) ;
- printf(" max. no. of sectors per read = %d \n",ASIZE/(2*512));
-
- printf(" drive number (0=a , 1=b ...) \n") ;
- scanf("%d",&dno) ;
- printf(" number of sectors per read: \n");
- scanf("%d",&nseg) ;
- printf(" starting sector number (0 = beginning of disk: \n");
- scanf("%d",&nstart) ;
- printf(" offset between reads (0=sequential I/O) \n");
- scanf("%d",&offset) ;
- printf(" number of iterations: \n");
- scanf("%d",&nit) ;
- if( nseg > 24 )
- { printf(" too many sectors per read \n");
- exit(10) ;
- }
- /* now do the operation */
- if( offset == 0 )
- t = seqio(dno,nseg,nstart,pbuf,nit) ;
- else t = randio(dno,nseg,nstart,pbuf,nit,offset) ;
-
-
- printf(" %4.2f Seconds \n", t /18.2 ) ;
- printf(" %4.3f Seconds per read operation \n", t / (18.2*nit) ) ;
- }
-